Repository navigation
chore(build): add a modern-only frontend build - #1532
Merged
Merged
Conversation
@vitejs/plugin-legacy rebuilds and Babel-transpiles the whole app for a nomodule fallback the Chrome 81 baseline never uses, and it dominates build time and memory. Gate it behind SQLBOT_LEGACY and add a build:modern script so routine builds can skip it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@vitejs/plugin-legacy会把整个应用用 Babel 再构建一遍并生成nomodule兜底包。但本项目的build.target和 legacytargets都是Chrome >= 81,Chrome 81 本身支持 ES module,这份兜底基本用不上,却占掉了构建的大部分时间和内存。SQLBOT_LEGACY环境变量给 legacy 插件加开关,默认仍然开启,老行为不变;新增build:modern脚本跳过它。Measured locally (Apple Silicon, Vite 6.4.3)
npm run build*-legacy-*.js、polyfills-*.jsnpm run build:modernUsage
npm run build:保持现状(含 legacy)npm run build:modern:仅现代包SQLBOT_LEGACY=false npm run buildTest plan
npm run build产物与改动前一致(含 legacy 资源)npm run build:modern能正常产出,浏览器访问无缺失 polyfill 报错(最低 Chrome 81)npx vue-tsc -b、npx eslint vite.config.ts通过🤖 Generated with Claude Code